package com.ruicar.afs.cloud.gateway.handler;

import com.ruicar.afs.cloud.gateway.components.LoginProcessHolder;
import com.ruicar.afs.cloud.gateway.util.AfsGateWayHelper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

/**
 * @author Fzero
 * @date 2019-01-24
 * 登录处理逻辑
 */
@Slf4j
@Component
@AllArgsConstructor
public class AfsLoginHandler extends AbstractOauthOperationHandler  {

	/**
	 * Handle the given request.
	 *
	 * @param request the request to handle
	 * @return the response
	 */
	@Override
	public Mono<ServerResponse> handle(ServerRequest request) {
		return LoginProcessHolder.getLoginProcess(AfsGateWayHelper.getClientType(request)).handle(request);
	}
}
